//
//  PicSeeCollectionViewCell.m
//  EDPS
//
//  Created by 张维扬 on 15/12/1.
//  Copyright © 2015年 张维扬. All rights reserved.
//

#import "PicSeeCollectionViewCell.h"
#import "Masonry.h"
#import "UIImageView+WebCache.h"
@interface PicSeeCollectionViewCell ()
@property (nonatomic, strong) UIImageView *img;
@property (nonatomic, strong) UILabel *text;
@end

@implementation PicSeeCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.img = [[UIImageView alloc] init];
        self.img.contentMode = UIViewContentModeScaleAspectFit;
        [self.contentView addSubview:self.img];
        
        self.text = [[UILabel alloc] init];
        self.text.textColor = [UIColor whiteColor];
        [self.contentView addSubview:self.text];
    }
    return self;
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.img.frame = CGRectMake(0, 0, layoutAttributes.size.width, layoutAttributes.size.height);
    
//    CGFloat textHeight = [[self class] heightWithText:self.model.text fontSize:16 width:ScreenWidth];
}

- (void)setModel:(DetailTravelModel *)model
{
    if (_model != model) {
        _model = model;
    }
    [self.img sd_setImageWithURL:[NSURL URLWithString:model.photo] placeholderImage:[UIImage imageNamed:@"hold"]];
    self.text.text = model.text;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
